/**
 * Created by MADinow on 26.10.2014.
 */

/* -----------------------------------------------------------
         POPUP EVENTS MODULE
 ----------------------------------------------------------- */

define(['ui/popup-ui', 'jquery', 'jquery_ui'],
    function (Popup) {

        /**
         * register basic events for any popup window
         * @private
         */
        function _registerPopupEvents(){

            $('.close-icon').bind({
                click: function(e){
                    e.stopPropagation();
                    Popup.closePopup();
                }
            });
        }

        /**
         * register specific events for a certain popup window by its ID
         * @param popupID
         * @private
         */
        function _registerPopupSpecificEvents(popupID){
            var _id = '#page-dimmer #'+popupID ;
            $(_id).bind({
                click: function(e){
                    e.stopPropagation();
                }
            });
        }

        /**
         * public interface
         */
        return {
            registerPopupEvents: _registerPopupEvents,
            registerPopupSpecificEvents: _registerPopupSpecificEvents
        }

    }
);